<template>
	<!-- 显示tag -->
	<el-table-column :width="row.width" :align="row.align || 'center'" :label="row.label || ''" :prop="row.prop"
		v-if="showColumn(row)">
		<template slot-scope="scope">
			<el-tag :type="getTagType(row.rules,scope.row[row.prop])">{{scope.row[row.prop]}}</el-tag>
		</template>
	</el-table-column>
</template>

<script>
	export default {
		props: {
			row: Object,
		},
		inject: ['vm'],
		methods: {
			showColumn(b) {
				// console.log('show111', b.show(this.vm));
				if (b.show) return b.show(this.vm);
				return true;
			},
			// 获取tag类型
			getTagType(rules, value) {
				let item = rules.find((i) => i.value == value);
				if (item) return item.type;
				return "primary";
			},
		},
	};
</script>

<style>
</style>